@extends('admin.layout.layout')
@section('content')
<!-- 配置文件 -->
<script type="text/javascript" src="/public/baidu/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/public/baidu/ueditor.all.js"></script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="/public/baidu/adminHTML/UEditor/lang/zh-cn/zh-cn.js"></script>

    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">分类修改</h1>
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->
    <div class="panel-body">
        <div class="row">
            <div class="col-lg-6 col-lg-offset-3">
                    @if (count($errors) > 0)
                
                <div class="alert alert-danger">
                    <ul>
                        @foreach ($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            @endif
                <form action="{{url('/admin/goods/update')}}" method="post" enctype="multipart/form-data">
                    <input type="hidden" name="id" value="{{ $goods->id }}">
                    <div class="form-group">
                        <label>选择分类</label>
                        <select name="cate_id" class="form-control">
                            @foreach($cates as $k=>$v)
                                <option value="{{$v->id}}" @if($v->id == $goods->cate_id)
                                                            selected
                                                           @endif
                                >{{$v->name}}</option>
                            @endforeach
                        </select>
                    </div>
                    <div class="form-group">
                        <label>选择店铺</label>
                        <select name="market_id" class="form-control">
                            @foreach($market as $k=>$v)
                                <option value="{{$v->id}}" @if($v->id == $goods->market_id)
                                                            selected
                                                           @endif
                                >{{$v->mar_name}}</option>
                            @endforeach
                        </select>
                    </div>
                    <div class="form-group">
                        <label>商品名称</label>
                        <input class="form-control" type="text" name="goods_name" value="{{ $goods->goods_name }}">
                    </div>
                    <div class="form-group">
                        <label>商品价格</label>
                        <input class="form-control" type="text" name="goods_price" value="{{ $goods->goods_price }}">
                    </div>
                    <div class="form-group">
                        <label>商品折扣</label>
                        <input class="form-control" type="text" name="rebate" value="{{ $goods->rebate }}">
                    </div>
                    <div class="form-group">
                        <label>商品库存</label>
                        <input class="form-control" type="text" name="goods_stock" value="{{ $goods->goods_stock }}">
                    </div>
                    <div class="form-group">
                        <label>商品颜色</label><br>
                        <input type="checkbox" name="goods_color[]" @foreach($goods->goods_color as $k=>$v){
                                                                        @if($v == '1')
                                                                            checked
                                                                        @endif
                                                                    }
                                                                    @endforeach
                        value="red" id="red"><label for="red">红色</label>&nbsp;
                        <input type="checkbox" name="goods_color[]" @foreach($goods->goods_color as $k=>$v){
                                                                        @if($v == '2')
                                                                            checked
                                                                        @endif
                                                                    }
                                                                    @endforeach
                        value="yellow" id="yellow"><label for="yellow">黄色</label>&nbsp;
                        <input type="checkbox" name="goods_color[]" @foreach($goods->goods_color as $k=>$v){
                                                                        @if($v == '3')
                                                                            checked
                                                                        @endif
                                                                    }
                                                                    @endforeach
                        value="blue" id="blue"><label for="blue">蓝色</label>&nbsp;
                        <input type="checkbox" name="goods_color[]" @foreach($goods->goods_color as $k=>$v){
                                                                        @if($v == '4')
                                                                            checked
                                                                        @endif
                                                                    }
                                                                    @endforeach
                        value="white" id="white"><label for="white">绿色</label>&nbsp;
                        <input type="checkbox" name="goods_color[]" @foreach($goods->goods_color as $k=>$v){
                                                                        @if($v == '5')
                                                                            checked
                                                                        @endif
                                                                    }
                                                                    @endforeach
                        value="black" id="black"><label for="black">黑色</label>&nbsp;
                        <input type="checkbox" name="goods_color[]" @foreach($goods->goods_color as $k=>$v){
                                                                        @if($v == '6')
                                                                            checked
                                                                        @endif
                                                                    }
                                                                    @endforeach
                        value="black" id="black"><label for="black">白色</label>&nbsp;
                    </div>
                    <div class="form-group">
                        <label>商品大小</label><br>
                        <input type="checkbox" name="goods_size[]" @foreach($goods->goods_size as $k=>$v){
                                                                        @if($v == '1')
                                                                            checked
                                                                        @endif
                                                                    }
                                                                    @endforeach
                        value="XXS" id="XXS"><label for="XXS">XXS</label>&nbsp;
                        <input type="checkbox" name="goods_size[]" @foreach($goods->goods_size as $k=>$v){
                                                                        @if($v == '2')
                                                                            checked
                                                                        @endif
                                                                    }
                                                                    @endforeach
                        value="XS" id="XS"><label for="XS">XS</label>&nbsp;
                        <input type="checkbox" name="goods_size[]" @foreach($goods->goods_size as $k=>$v){
                                                                        @if($v == '3')
                                                                            checked
                                                                        @endif
                                                                    }
                                                                    @endforeach
                        value="S" id="S"><label for="S">S</label>&nbsp;
                        <input type="checkbox" name="goods_size[]" @foreach($goods->goods_size as $k=>$v){
                                                                        @if($v == '4')
                                                                            checked
                                                                        @endif
                                                                    }
                                                                    @endforeach
                        value="M" id="M"><label for="M">M</label>&nbsp;
                        <input type="checkbox" name="goods_size[]" @foreach($goods->goods_size as $k=>$v){
                                                                        @if($v == '5')
                                                                            checked
                                                                        @endif
                                                                    }
                                                                    @endforeach
                        value="L" id="L"><label for="L">L</label>&nbsp;
                        <input type="checkbox" name="goods_size[]" @foreach($goods->goods_size as $k=>$v){
                                                                        @if($v == '6')
                                                                            checked
                                                                        @endif
                                                                    }
                                                                    @endforeach
                        value="XL" id="XL"><label for="XL">XL</label>&nbsp;
                        <input type="checkbox" name="goods_size[]" @foreach($goods->goods_size as $k=>$v){
                                                                        @if($v == '7')
                                                                            checked
                                                                        @endif
                                                                    }
                                                                    @endforeach
                        value="XXL" id="XXL"><label for="XXL">XXL</label>&nbsp;
                        <input type="checkbox" name="goods_size[]" @foreach($goods->goods_size as $k=>$v){
                                                                        @if($v == '8')
                                                                            checked
                                                                        @endif
                                                                    }
                                                                    @endforeach
                        value="XXXL" id="XXXL"><label for="XXXL">XXXL</label>&nbsp;
                    </div>
                    <div class="form-group">
                        <label>商品图片</label>
                        <img src="{{ $goods->goods_pic }}" width="100px" alt="">
                        <input type="file" name="goods_pic">
                    </div>
                    <div class="form-group">
                        <label>商品描述</label>
                        <!-- 加载编辑器的容器 -->
                        <script id="container" name="goods_content" type="text/plain">{!! $goods->goods_content !!}</script>
                    </div>
                        {{ csrf_field() }}
                    <button type="submit" class="btn btn-primary btn-lg" style="margin-left:90px;width:100px">保存</button>
                </form>
                </div>
            </div>
        </div>

<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container');
</script>
@endsection